IntentSanitizer

This class is used to make a sanitized copy of an Intent. This could be used when UnsafeIntentLaunchViolation is detected. This class is thread safe and the object created is safe to be reused. Typical usage of the class:


Intent intent = new  IntentSanitizer.Builder()
     .allowComponent(“com.example.ActivityA”)
     .allowData(“com.example”)
     .allowType(“text/plain”)
     .build()
     .sanitizeByThrowing(intent);
At least one of the allowPackage, allowComponent must be called unless implicit intent is allowed. In which case, allowAnyComponent must be called and caution has to be taken to protect your private data.

Types

Link copied to clipboard
class Builder
General strategy of building is to only offer additive “or” operations that are chained together.

Functions

Link copied to clipboard
open fun sanitize(@NonNull in: Intent, @NonNull penalty: Consumer<String>): Intent
This method sanitizes the given intent.
Link copied to clipboard
Convenient method for filtering unwanted members from the input intent and log it.
Link copied to clipboard
Convenient method for throwing a SecurityException when unwanted members of the input intent is encountered.